﻿using System.Collections.Generic;

namespace Bilibili.Model.Home
{
    public sealed class HomeDataModel
    {
        public List<BannerItem> banner_item { get; set; }
        private string _title = "";
        public string title
        {
            get
            {
                if (_title == "" && uri == "")
                    return "你追的番剧更新啦~";
                return _title;
            }
            set { _title = value; }
        }
        public string cover { get; set; }
        public string uri { get; set; }
        public string param { get; set; }
        public string card_goto { get; set; }
        public string idx { get; set; }
        public ThreePoint three_point { get; set; }
        public HomeFeedArgs args { get; set; }
        public HomeFeedRcmdReasonStyle rcmd_reason_style { get; set; }
        public HomeFeedDescButton desc_button { get; set; }
        public string cover_left_text_1 { get; set; }
        public string cover_left_text_2 { get; set; }
        public int cover_left_icon_1 { get; set; }
        public int cover_left_icon_2 { get; set; }
        public string left_text
        {
            get
            {
                return $"{iconToText(cover_left_icon_1)}{cover_left_text_1 ?? ""} {iconToText(cover_left_icon_2)}{cover_left_text_2 ?? ""}";
            }
        }
        public string cover_right_text { get; set; }
        public string badge { get; set; }
        public bool showBadge
        {
            get
            {
                return !string.IsNullOrEmpty(badge);
            }
        }
        public bool showCoverText
        {
            get
            {
                return !string.IsNullOrEmpty(cover_left_text_1) || !string.IsNullOrEmpty(cover_left_text_2) || !string.IsNullOrEmpty(cover_right_text);
            }
        }
        public bool showRcmd
        {
            get
            {
                return rcmd_reason_style != null && !string.IsNullOrEmpty(rcmd_reason_style.text);
            }
        }
        public string bottomText
        {
            get
            {
                if (desc_button != null)
                {
                    return desc_button.text;
                }
                return "";
            }
        }
        public string iconToText(int icon)
        {
            switch (icon)
            {
                case 1:
                case 6:
                    return "观看:";
                case 2:
                    return "人气:";
                case 3:
                    return "弹幕:";
                case 4:
                    return "追番:";
                case 7:
                    return "评论:";
                default:
                    return "";
            }
        }
    }
}